#ifndef __BL_S_H_
#define __BL_S_H_
    
#define MAX_Start_Duty                               (uint16)(Max_Start_Duty*PWM_VALUE_LOAD)
#define BLDC_Start_Duty0                             (uint16)(Start_Duty0*PWM_VALUE_LOAD)
#define BLDC_Start_Duty1                             (uint16)(Start_Duty1*PWM_VALUE_LOAD)
#define BLDC_Start_Duty2                             (uint16)(Start_Duty2*PWM_VALUE_LOAD)
#define BLDC_Start_Duty3                             (uint16)(Start_Duty3*PWM_VALUE_LOAD)





typedef struct
{
	uint8   BDIF_Flag;               //	 续流屏蔽标志位 
//    uint8   COM_Flag;                //	  换相标志位
    uint8   Level;                   //	   电平信号
    uint8   Edge_Flt_cnt;            //	  正确换相计数值
// 	uint8   ON_OFF_FLAG;             //	   0 -- OFF采样 ，1 -- on采样
    
    
    uint8   First_Step;       
	uint16  PWM_COUNT;               //	 载波计算个数
	uint16  PWM_COUNT_LAST;          //	  载波计算个数  
//    uint16  PWM_COUNT_SUM;          //    载波计算个数 求和
// 	uint16  PWM_COUNT_LPF;          //	     载波计算个数平均

    uint8		BLDCSetFlag;
    
    uint16  COM_COUNT;               //	   软件换相计数值
    uint16  Right_COUNT;             //	   正确换相计数值
    uint16  Force_COUNT;             //	   强制换相计数值
    
} BLDC_PARA;



//extern BL_S_TypeDef idata BL_S;       							
extern uint8   xdata    CW_CMPOUT[7];                 
extern uint8   xdata    CCW_CMPOUT[7];                 
extern BLDC_PARA xdata BLDC;
extern void BL_S_ParaInit(void);
extern void BL_S_Function();      
extern void TIM1_BLS_Init(void);
extern void TIM1_TO_Hardware(void);
extern void PWMCount_LPF( void );

#endif